Now that we know how to create classes, access slots, and define methods, it might be useful to verify that everything is doing ok. To help with this a plethora of predicates have been created.
Return the class that symbol represents. If there is no class,
nilis returned if errorp isnil. If errorp is non-nil,wrong-argument-typeis signaled.
Non-
nilif OBJECT's slot is bound. Setting a slot's value makes it bound. Calling slot-makeunbound will make a slot unbound. object can be an instance or a class.
Return a string of the form ‘#<class myclassname>’ which should look similar to other Lisp objects like buffers and processes. Printing a class results only in a symbol.
Return the value in CLASS of a given OPTION. For example:
(class-option eieio-default-superclass :documentation)Will fetch the documentation string for
eieio-default-superclass.
Return a symbol used as a constructor for class. The constructor is a function used to create new instances of CLASS. This function provides a way to make an object of a class without knowing what it is. This is not a part of CLOS.
Return a string of the form ‘#<object-class myobjname>’ for obj. This should look like Lisp symbols from other parts of Emacs such as buffers and processes, and is shorter and cleaner than printing the object's vector. It is more useful to use
object-printto get and object's print form, as this allows the object to add extra display information into the symbol.
Same as
object-classexcept this is a macro, and no type-checking is performed.
Returns the direct parents class of class. Returns
nilif it is a superclass.
Just like
class-parentexcept it is a macro and no type checking is performed.
Same as
same-class-pexcept this is a macro and no type checking is performed.